package com.safeluck.scannerqcr.fragment.shop;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.safeluck.scannerqcr.R;
import com.safeluck.scannerqcr.fragment.BaseMainFragment;

import me.yokeyword.fragmentation.ISupportFragment;

/**
 * ScannerQCR
 * Created by lzw on 2017/12/5. 11:57:50
 * 邮箱：632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */

public class ContentFragment extends BaseMainFragment {

    private static final String MENU_ITEM = "menu_item";
    private TextView tv_conn;
    private String s;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.content_fragment,container,false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        tv_conn = view.findViewById(R.id.tv_con);
    }

    public static ISupportFragment newInstance(String s) {
        Bundle bundle = new Bundle();
        bundle.putString(MENU_ITEM,s);
        ContentFragment contentFragment = new ContentFragment();
        contentFragment.setArguments(bundle);
        return contentFragment;
    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);
        if (!TextUtils.isEmpty(s))
        tv_conn.setText(s);
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle arg = getArguments();
        if (arg != null){
            s = arg.getString(MENU_ITEM);
        }
    }
}
